package com.qfjy.homework.maleyi;

public class CarNameFactory {
    public CarName getCarName(String carName){
        if (carName == null){
            return null;
        }
        if (carName.equalsIgnoreCase("Audi")){
            return new Audi();
        } else if (carName.equalsIgnoreCase("Bmw")) {
            return new Bmw();
        } else if (carName.equalsIgnoreCase("Benz")) {
            return new Benz();
        }
        return null;
    }
}
